FHIR © HL7.org  |  Server Home  |  FHIR Server FHIR Server 3.4.11  |  FHIR Version n/a  User: [n/a]

Resource StructureMap/FHIR Server from package who.ddcc#current (79 ms)

Package who.ddcc
Type StructureMap
Id Id
FHIR Version R4
Source http://smart.who.int/ddcc/https://build.fhir.org/ig/WorldHealthOrganization/ddcc/StructureMap-IPSToCoreDataSetVS.html
Url http://smart.who.int/ddcc/StructureMap/IPSToCoreDataSetVS
Version 1.0.0
Status draft
Date 2024-10-17T05:03:04+00:00
Name IPSToCoreDataSetVS
Experimental False
Realm uv
Authority who

Resources that use this resource

No resources found


Resources that this resource uses

No resources found



Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: StructureMap IPSToCoreDataSetVS

map "http://smart.who.int/ddcc/StructureMap/IPSToCoreDataSetVS" = "IPSToCoreDataSetVS"

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias IPS as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias DDCCBundle as target
uses "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV" alias DDCC as target

group IPSToCoreDataSetVS(source ips : IPS, target ddccBundle : DDCCBundle) {
  ips.id as id -> ddccBundle.id = id "set id";
  ips.entry first as compentry then {
    compentry.resource : Composition as composition then {
      composition.subject as subject then {
        subject.reference as patientid then {
          ips.entry as findpatient where resource.is(Patient) and (resource.id = patientid.replaceMatches('.*Patient/(?<id>[A-Za-z0-9\\-\\.]{1,64})$', '${id}')) then {
            findpatient.resource as patient then {
              ips.entry as entry then {
                entry.resource : Immunization as immunization where vaccineCode.memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19') ->  ddccBundle.entry as outentry,  create('http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV') as ddcc then {
                  immunization then PatientToDDCC(patient, ddcc) "set patient info";
                  immunization -> ddcc.vaccination as vaccination then ImmunizationToVaccination(immunization, vaccination) "set vaccination";
                  immunization -> ddcc.certificate as certificate then IPSToCertificate(composition, certificate, immunization) "set certificate";
                  immunization -> outentry.resource = ddcc "set outentry";
                } "immunizations";
              } "entries";
            } "get patient";
          } "find patient";
        } "get subject reference";
      } "get subject";
    } "get composition";
  } "get first entry";
// ips -> ddcc.vaccination as vaccination then IPSToVaccination( ips, vaccination ) "set vaccination content";
}

group ImmunizationToVaccination(source immunization, target vaccination) {
  immunization.vaccineCode as vaccine then {
    vaccine.coding as coding where memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19') then {
      coding -> vaccination.vaccine = coding "set coding";
    } "copy vaccine";
    vaccine.coding as coding where memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19').not() then {
      coding -> vaccination.vaccine = translate(coding, 'who-ddcc-map-cvx-icd11-vaccines', 'Coding') "translate code";
    } "translate vaccine coding";
    vaccine.coding as coding -> vaccination.brand = translate(coding, 'who-ddcc-map-cvx-icd11-brands', 'Coding') "translate brand";
  } "set vaccine";
  immunization -> vaccination.country = c('urn:iso:std:iso:3166', 'USA') "set country";
  immunization.lotNumber as lot -> vaccination.lot = lot "set lot";
  immunization.occurrence as occurrence -> vaccination.date = occurrence "set date";
  immunization.manufacturer as manufacturer then {
    manufacturer.identifier as identifier -> vaccination.manufacturer as vMan then {
      identifier.system as system -> vMan.system = system "set manufacturer system";
      identifier.value as value -> vMan.code = value "set manufactutuer code";
    } "set manufacturer id";
  } "set manufacturer";
}

group IPSToCertificate(source composition, target certificate, source immunization) {
  immunization.id as id ->  certificate.ddccid as ddccid,  ddccid.value = id "set ddccid";
  composition.id as id ->  certificate.hcid as hcid,  hcid.value = id "set hcid";
  composition.author first as author -> certificate.issuer = author "set issuer";
// composition.author first as author -> certificate.issuer as issuer then {
// author -> issuer.identifier as identifier then {
// author.reference as authorref -> identifier.value = (authorref.replaceMatches('.*/(?<id>[A-Za-z0-9\\-\\.]{1,64})$', '${id}')) "set identifier value";
// } "set from reference";
// author.identifier as ident -> issuer.identifier = ident "set from identifier";
// } "set issuer";
}

group PatientToDDCC(source patient, target ddcc) {
  patient.name as name then NameToText(name, ddcc) "set name";
  patient.birthDate as birthDate -> ddcc.birthDate = birthDate "set birthdate";
  // patient.gender as gender -> ddcc.sex = gender "set sex";
  patient.identifier first as identifier -> ddcc.identifier = identifier "set identifier";
}

group NameToText(source name : HumanName, target ddcc) {
  // annoying because append doesn't work until ddcc.name is set
  name.given first as given -> ddcc.name = (given.replaceMatches('$', ' ')) "set first name";
  // name.given not_first as other -> ddcc.name as tName, ddcc.name = append( tName, other ) "set other names";
  name.given not_first as other ->  ddcc.name as tName,  (other.replaceMatches('$', ' ')) as spaced,  ddcc.name = append(tName, spaced) "set other names";
  name.family as family ->  ddcc.name as tName,  ddcc.name = append(tName, family) "add family name";
  name.text as text -> ddcc.name = text "set full name";
}


Source

{
  "resourceType" : "StructureMap",
  "id" : "IPSToCoreDataSetVS",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap IPSToCoreDataSetVS</b></p><a name=\"IPSToCoreDataSetVS\"> </a><a name=\"hcIPSToCoreDataSetVS\"> </a><a name=\"IPSToCoreDataSetVS-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://smart.who.int/ddcc/StructureMap/IPSToCoreDataSetVS<span style=\"color: navy\">&quot; = &quot;</span>IPSToCoreDataSetVS<span style=\"color: navy\">&quot;\r\n\r\n</span><b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>IPS <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>DDCCBundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureDefinition-DDCCCoreDataSetVSPoV.html\" title=\"DDCC Core Data Set Logical Model - Vaccination Status - Proof of Vaccination\">http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV</a><span style=\"color: navy\">&quot; </span><b>alias </b>DDCC <b>as </b><b>target</b>\r\n\r\n<b>group </b>IPSToCoreDataSetVS<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">ips</span><span style=\"color: navy\"> : </span>IPS, <b>target</b> <span style=\"color: maroon\">ddccBundle</span><span style=\"color: navy\"> : </span>DDCCBundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> ips.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -&gt; </b></span>ddccBundle.id = <span style=\"color: maroon\">id</span> <i>&quot;set id&quot;</i><span style=\"color: navy\">;</span>\r\n ips.entry first<b> as </b><span style=\"color: maroon\">compentry</span><b> then</b><span style=\"color: navy\"> {\r\n</span> compentry.resource<span style=\"color: navy\"> : </span>Composition<b> as </b><span style=\"color: maroon\">composition</span><b> then</b><span style=\"color: navy\"> {\r\n</span> composition.subject<b> as </b><span style=\"color: maroon\">subject</span><b> then</b><span style=\"color: navy\"> {\r\n</span> subject.reference<b> as </b><span style=\"color: maroon\">patientid</span><b> then</b><span style=\"color: navy\"> {\r\n</span> ips.entry<b> as </b><span style=\"color: maroon\">findpatient</span><b> where </b>resource.is(Patient) and (resource.id = patientid.replaceMatches('.*Patient/(?&lt;id&gt;[A-Za-z0-9\\\\-\\\\.]{1,64})$', '${id}'))<b> then</b><span style=\"color: navy\"> {\r\n</span> findpatient.resource<b> as </b><span style=\"color: maroon\">patient</span><b> then</b><span style=\"color: navy\"> {\r\n</span> ips.entry<b> as </b><span style=\"color: maroon\">entry</span><b> then</b><span style=\"color: navy\"> {\r\n</span> entry.resource<span style=\"color: navy\"> : </span>Immunization<b> as </b><span style=\"color: maroon\">immunization</span><b> where </b>vaccineCode.memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19')<span style=\"color: navy\"><b> -&gt; </b></span> ddccBundle.entry<b> as </b><span style=\"color: maroon\">outentry</span><span style=\"color: navy\">, </span> <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ddcc</span><b> then</b><span style=\"color: navy\"> {\r\n</span> immunization<b> then </b>PatientToDDCC<span style=\"color: navy\">(</span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ddcc</span><span style=\"color: navy\">)</span> <i>&quot;set patient info&quot;</i><span style=\"color: navy\">;</span>\r\n immunization<span style=\"color: navy\"><b> -&gt; </b></span>ddcc.vaccination<b> as </b><span style=\"color: maroon\">vaccination</span><b> then </b>ImmunizationToVaccination<span style=\"color: navy\">(</span><span style=\"color: maroon\">immunization</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">vaccination</span><span style=\"color: navy\">)</span> <i>&quot;set vaccination&quot;</i><span style=\"color: navy\">;</span>\r\n immunization<span style=\"color: navy\"><b> -&gt; </b></span>ddcc.certificate<b> as </b><span style=\"color: maroon\">certificate</span><b> then </b>IPSToCertificate<span style=\"color: navy\">(</span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">certificate</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">immunization</span><span style=\"color: navy\">)</span> <i>&quot;set certificate&quot;</i><span style=\"color: navy\">;</span>\r\n immunization<span style=\"color: navy\"><b> -&gt; </b></span>outentry.resource = <span style=\"color: maroon\">ddcc</span> <i>&quot;set outentry&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;immunizations&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;entries&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;get patient&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;find patient&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;get subject reference&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;get subject&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;get composition&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;get first entry&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: #b36b00\" title=\"This element was not defined prior to R5\">// ips -&gt; ddcc.vaccination as vaccination then IPSToVaccination( ips, vaccination ) &quot;set vaccination content&quot;;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ImmunizationToVaccination<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">immunization</span>, <b>target</b> <span style=\"color: maroon\">vaccination</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> immunization.vaccineCode<b> as </b><span style=\"color: maroon\">vaccine</span><b> then</b><span style=\"color: navy\"> {\r\n</span> vaccine.coding<b> as </b><span style=\"color: maroon\">coding</span><b> where </b>memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19')<b> then</b><span style=\"color: navy\"> {\r\n</span> coding<span style=\"color: navy\"><b> -&gt; </b></span>vaccination.vaccine = <span style=\"color: maroon\">coding</span> <i>&quot;set coding&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;copy vaccine&quot;</i><span style=\"color: navy\">;</span>\r\n vaccine.coding<b> as </b><span style=\"color: maroon\">coding</span><b> where </b>memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19').not()<b> then</b><span style=\"color: navy\"> {\r\n</span> coding<span style=\"color: navy\"><b> -&gt; </b></span>vaccination.vaccine = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'who-ddcc-map-cvx-icd11-vaccines'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span> <i>&quot;translate code&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;translate vaccine coding&quot;</i><span style=\"color: navy\">;</span>\r\n vaccine.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span>vaccination.brand = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'who-ddcc-map-cvx-icd11-brands'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span> <i>&quot;translate brand&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set vaccine&quot;</i><span style=\"color: navy\">;</span>\r\n immunization<span style=\"color: navy\"><b> -&gt; </b></span>vaccination.country = <b>c</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:iso:std:iso:3166'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'USA'</span><span style=\"color: navy\">)</span> <i>&quot;set country&quot;</i><span style=\"color: navy\">;</span>\r\n immunization.lotNumber<b> as </b><span style=\"color: maroon\">lot</span><span style=\"color: navy\"><b> -&gt; </b></span>vaccination.lot = <span style=\"color: maroon\">lot</span> <i>&quot;set lot&quot;</i><span style=\"color: navy\">;</span>\r\n immunization.occurrence<b> as </b><span style=\"color: maroon\">occurrence</span><span style=\"color: navy\"><b> -&gt; </b></span>vaccination.date = <span style=\"color: maroon\">occurrence</span> <i>&quot;set date&quot;</i><span style=\"color: navy\">;</span>\r\n immunization.manufacturer<b> as </b><span style=\"color: maroon\">manufacturer</span><b> then</b><span style=\"color: navy\"> {\r\n</span> manufacturer.identifier<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\"><b> -&gt; </b></span>vaccination.manufacturer<b> as </b><span style=\"color: maroon\">vMan</span><b> then</b><span style=\"color: navy\"> {\r\n</span> identifier.system<b> as </b><span style=\"color: maroon\">system</span><span style=\"color: navy\"><b> -&gt; </b></span>vMan.system = <span style=\"color: maroon\">system</span> <i>&quot;set manufacturer system&quot;</i><span style=\"color: navy\">;</span>\r\n identifier.value<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>vMan.code = <span style=\"color: maroon\">value</span> <i>&quot;set manufactutuer code&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set manufacturer id&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>&quot;set manufacturer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>IPSToCertificate<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">composition</span>, <b>target</b> <span style=\"color: maroon\">certificate</span>, <b>source</b> <span style=\"color: maroon\">immunization</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> immunization.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -&gt; </b></span> certificate.ddccid<b> as </b><span style=\"color: maroon\">ddccid</span><span style=\"color: navy\">, </span> ddccid.value = <span style=\"color: maroon\">id</span> <i>&quot;set ddccid&quot;</i><span style=\"color: navy\">;</span>\r\n composition.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -&gt; </b></span> certificate.hcid<b> as </b><span style=\"color: maroon\">hcid</span><span style=\"color: navy\">, </span> hcid.value = <span style=\"color: maroon\">id</span> <i>&quot;set hcid&quot;</i><span style=\"color: navy\">;</span>\r\n composition.author first<b> as </b><span style=\"color: maroon\">author</span><span style=\"color: navy\"><b> -&gt; </b></span>certificate.issuer = <span style=\"color: maroon\">author</span> <i>&quot;set issuer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: #b36b00\" title=\"This element was not defined prior to R5\">// composition.author first as author -&gt; certificate.issuer as issuer then {</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">author -&gt; issuer.identifier as identifier then {</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">author.reference as authorref -&gt; identifier.value = (authorref.replaceMatches('.*/(?&lt;id&gt;[A-Za-z0-9\\\\-\\\\.]{1,64})$', '${id}')) &quot;set identifier value&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;set from reference&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">author.identifier as ident -&gt; issuer.identifier = ident &quot;set from identifier&quot;;</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">} &quot;set issuer&quot;;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PatientToDDCC<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">patient</span>, <b>target</b> <span style=\"color: maroon\">ddcc</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> patient.name<b> as </b><span style=\"color: maroon\">name</span><b> then </b>NameToText<span style=\"color: navy\">(</span><span style=\"color: maroon\">name</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">ddcc</span><span style=\"color: navy\">)</span> <i>&quot;set name&quot;</i><span style=\"color: navy\">;</span>\r\n patient.birthDate<b> as </b><span style=\"color: maroon\">birthDate</span><span style=\"color: navy\"><b> -&gt; </b></span>ddcc.birthDate = <span style=\"color: maroon\">birthDate</span> <i>&quot;set birthdate&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: #b36b00\" title=\"This element was not defined prior to R5\">// patient.gender as gender -&gt; ddcc.sex = gender &quot;set sex&quot;;</span>\r\n patient.identifier first<b> as </b><span style=\"color: maroon\">identifier</span><span style=\"color: navy\"><b> -&gt; </b></span>ddcc.identifier = <span style=\"color: maroon\">identifier</span> <i>&quot;set identifier&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>NameToText<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">name</span><span style=\"color: navy\"> : </span>HumanName, <b>target</b> <span style=\"color: maroon\">ddcc</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> <span style=\"color: navy\">// </span><span style=\"color: green\">annoying because append doesn't work until ddcc.name is set</span>\r\n name.given first<b> as </b><span style=\"color: maroon\">given</span><span style=\"color: navy\"><b> -&gt; </b></span>ddcc.name = <span style=\"color: navy\">(</span>given.replaceMatches('$', ' ')<span style=\"color: navy\">)</span> <i>&quot;set first name&quot;</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: #b36b00\" title=\"This element was not defined prior to R5\">// name.given not_first as other -&gt; ddcc.name as tName, ddcc.name = append( tName, other ) &quot;set other names&quot;;</span>\r\n name.given not_first<b> as </b><span style=\"color: maroon\">other</span><span style=\"color: navy\"><b> -&gt; </b></span> ddcc.name<b> as </b><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span> <span style=\"color: navy\">(</span>other.replaceMatches('$', ' ')<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">spaced</span><span style=\"color: navy\">, </span> ddcc.name = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">spaced</span><span style=\"color: navy\">)</span> <i>&quot;set other names&quot;</i><span style=\"color: navy\">;</span>\r\n name.family<b> as </b><span style=\"color: maroon\">family</span><span style=\"color: navy\"><b> -&gt; </b></span> ddcc.name<b> as </b><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span> ddcc.name = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">tName</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">family</span><span style=\"color: navy\">)</span> <i>&quot;add family name&quot;</i><span style=\"color: navy\">;</span>\r\n name.text<b> as </b><span style=\"color: maroon\">text</span><span style=\"color: navy\"><b> -&gt; </b></span>ddcc.name = <span style=\"color: maroon\">text</span> <i>&quot;set full name&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "http://smart.who.int/ddcc/StructureMap/IPSToCoreDataSetVS",
  "version" : "1.0.0",
  "name" : "IPSToCoreDataSetVS",
  "status" : "draft",
  "date" : "2024-10-17T05:03:04+00:00",
  "publisher" : "WHO",
  "contact" : [
    {
      "name" : "WHO",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://who.int"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "source",
      "alias" : "IPS"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "mode" : "target",
      "alias" : "DDCCBundle"
    },
    {
      "url" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV",
      "mode" : "target",
      "alias" : "DDCC"
    }
  ],
  "group" : [
    {
      "name" : "IPSToCoreDataSetVS",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "ips",
          "type" : "IPS",
          "mode" : "source"
        },
        {
          "name" : "ddccBundle",
          "type" : "DDCCBundle",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set id",
          "source" : [
            {
              "context" : "ips",
              "element" : "id",
              "variable" : "id"
            }
          ],
          "target" : [
            {
              "context" : "ddccBundle",
              "contextType" : "variable",
              "element" : "id",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "id"
                }
              ]
            }
          ]
        },
        {
          "name" : "get first entry",
          "source" : [
            {
              "context" : "ips",
              "element" : "entry",
              "listMode" : "first",
              "variable" : "compentry"
            }
          ],
          "rule" : [
            {
              "name" : "get composition",
              "source" : [
                {
                  "context" : "compentry",
                  "type" : "Composition",
                  "element" : "resource",
                  "variable" : "composition"
                }
              ],
              "rule" : [
                {
                  "name" : "get subject",
                  "source" : [
                    {
                      "context" : "composition",
                      "element" : "subject",
                      "variable" : "subject"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "get subject reference",
                      "source" : [
                        {
                          "context" : "subject",
                          "element" : "reference",
                          "variable" : "patientid"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "find patient",
                          "source" : [
                            {
                              "context" : "ips",
                              "element" : "entry",
                              "variable" : "findpatient",
                              "condition" : "resource.is(Patient) and (resource.id = patientid.replaceMatches('.*Patient/(?<id>[A-Za-z0-9\\\\-\\\\.]{1,64})$', '${id}'))"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "get patient",
                              "source" : [
                                {
                                  "context" : "findpatient",
                                  "element" : "resource",
                                  "variable" : "patient"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "entries",
                                  "source" : [
                                    {
                                      "context" : "ips",
                                      "element" : "entry",
                                      "variable" : "entry"
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "immunizations",
                                      "source" : [
                                        {
                                          "context" : "entry",
                                          "type" : "Immunization",
                                          "element" : "resource",
                                          "variable" : "immunization",
                                          "condition" : "vaccineCode.memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19')"
                                        }
                                      ],
                                      "target" : [
                                        {
                                          "context" : "ddccBundle",
                                          "contextType" : "variable",
                                          "element" : "entry",
                                          "variable" : "outentry"
                                        },
                                        {
                                          "contextType" : "variable",
                                          "variable" : "ddcc",
                                          "transform" : "create",
                                          "parameter" : [
                                            {
                                              "valueString" : "http://smart.who.int/ddcc/StructureDefinition/DDCCCoreDataSetVSPoV"
                                            }
                                          ]
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "set patient info",
                                          "source" : [
                                            {
                                              "context" : "immunization"
                                            }
                                          ],
                                          "dependent" : [
                                            {
                                              "name" : "PatientToDDCC",
                                              "variable" : [
                                                "patient",
                                                "ddcc"
                                              ]
                                            }
                                          ]
                                        },
                                        {
                                          "name" : "set vaccination",
                                          "source" : [
                                            {
                                              "context" : "immunization"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "ddcc",
                                              "contextType" : "variable",
                                              "element" : "vaccination",
                                              "variable" : "vaccination"
                                            }
                                          ],
                                          "dependent" : [
                                            {
                                              "name" : "ImmunizationToVaccination",
                                              "variable" : [
                                                "immunization",
                                                "vaccination"
                                              ]
                                            }
                                          ]
                                        },
                                        {
                                          "name" : "set certificate",
                                          "source" : [
                                            {
                                              "context" : "immunization"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "ddcc",
                                              "contextType" : "variable",
                                              "element" : "certificate",
                                              "variable" : "certificate"
                                            }
                                          ],
                                          "dependent" : [
                                            {
                                              "name" : "IPSToCertificate",
                                              "variable" : [
                                                "composition",
                                                "certificate",
                                                "immunization"
                                              ]
                                            }
                                          ]
                                        },
                                        {
                                          "name" : "set outentry",
                                          "source" : [
                                            {
                                              "context" : "immunization"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "outentry",
                                              "contextType" : "variable",
                                              "element" : "resource",
                                              "transform" : "copy",
                                              "parameter" : [
                                                {
                                                  "valueId" : "ddcc"
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "ImmunizationToVaccination",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "immunization",
          "mode" : "source"
        },
        {
          "name" : "vaccination",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set vaccine",
          "source" : [
            {
              "context" : "immunization",
              "element" : "vaccineCode",
              "variable" : "vaccine"
            }
          ],
          "rule" : [
            {
              "name" : "copy vaccine",
              "source" : [
                {
                  "context" : "vaccine",
                  "element" : "coding",
                  "variable" : "coding",
                  "condition" : "memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19')"
                }
              ],
              "rule" : [
                {
                  "name" : "set coding",
                  "source" : [
                    {
                      "context" : "coding"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "vaccination",
                      "contextType" : "variable",
                      "element" : "vaccine",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "coding"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "translate vaccine coding",
              "source" : [
                {
                  "context" : "vaccine",
                  "element" : "coding",
                  "variable" : "coding",
                  "condition" : "memberOf('http://smart.who.int/ddcc/ValueSet/WHODDCCVaccinesCOVID19').not()"
                }
              ],
              "rule" : [
                {
                  "name" : "translate code",
                  "source" : [
                    {
                      "context" : "coding"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "vaccination",
                      "contextType" : "variable",
                      "element" : "vaccine",
                      "transform" : "translate",
                      "parameter" : [
                        {
                          "valueId" : "coding"
                        },
                        {
                          "valueString" : "who-ddcc-map-cvx-icd11-vaccines"
                        },
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "translate brand",
              "source" : [
                {
                  "context" : "vaccine",
                  "element" : "coding",
                  "variable" : "coding"
                }
              ],
              "target" : [
                {
                  "context" : "vaccination",
                  "contextType" : "variable",
                  "element" : "brand",
                  "transform" : "translate",
                  "parameter" : [
                    {
                      "valueId" : "coding"
                    },
                    {
                      "valueString" : "who-ddcc-map-cvx-icd11-brands"
                    },
                    {
                      "valueString" : "Coding"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "set country",
          "source" : [
            {
              "context" : "immunization"
            }
          ],
          "target" : [
            {
              "context" : "vaccination",
              "contextType" : "variable",
              "element" : "country",
              "transform" : "c",
              "parameter" : [
                {
                  "valueString" : "urn:iso:std:iso:3166"
                },
                {
                  "valueString" : "USA"
                }
              ]
            }
          ]
        },
        {
          "name" : "set lot",
          "source" : [
            {
              "context" : "immunization",
              "element" : "lotNumber",
              "variable" : "lot"
            }
          ],
          "target" : [
            {
              "context" : "vaccination",
              "contextType" : "variable",
              "element" : "lot",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "lot"
                }
              ]
            }
          ]
        },
        {
          "name" : "set date",
          "source" : [
            {
              "context" : "immunization",
              "element" : "occurrence",
              "variable" : "occurrence"
            }
          ],
          "target" : [
            {
              "context" : "vaccination",
              "contextType" : "variable",
              "element" : "date",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "occurrence"
                }
              ]
            }
          ]
        },
        {
          "name" : "set manufacturer",
          "source" : [
            {
              "context" : "immunization",
              "element" : "manufacturer",
              "variable" : "manufacturer"
            }
          ],
          "rule" : [
            {
              "name" : "set manufacturer id",
              "source" : [
                {
                  "context" : "manufacturer",
                  "element" : "identifier",
                  "variable" : "identifier"
                }
              ],
              "target" : [
                {
                  "context" : "vaccination",
                  "contextType" : "variable",
                  "element" : "manufacturer",
                  "variable" : "vMan"
                }
              ],
              "rule" : [
                {
                  "name" : "set manufacturer system",
                  "source" : [
                    {
                      "context" : "identifier",
                      "element" : "system",
                      "variable" : "system"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "vMan",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "system"
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "set manufactutuer code",
                  "source" : [
                    {
                      "context" : "identifier",
                      "element" : "value",
                      "variable" : "value"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "vMan",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "IPSToCertificate",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "composition",
          "mode" : "source"
        },
        {
          "name" : "certificate",
          "mode" : "target"
        },
        {
          "name" : "immunization",
          "mode" : "source"
        }
      ],
      "rule" : [
        {
          "name" : "set ddccid",
          "source" : [
            {
              "context" : "immunization",
              "element" : "id",
              "variable" : "id"
            }
          ],
          "target" : [
            {
              "context" : "certificate",
              "contextType" : "variable",
              "element" : "ddccid",
              "variable" : "ddccid"
            },
            {
              "context" : "ddccid",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "id"
                }
              ]
            }
          ]
        },
        {
          "name" : "set hcid",
          "source" : [
            {
              "context" : "composition",
              "element" : "id",
              "variable" : "id"
            }
          ],
          "target" : [
            {
              "context" : "certificate",
              "contextType" : "variable",
              "element" : "hcid",
              "variable" : "hcid"
            },
            {
              "context" : "hcid",
              "contextType" : "variable",
              "element" : "value",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "id"
                }
              ]
            }
          ]
        },
        {
          "name" : "set issuer",
          "source" : [
            {
              "context" : "composition",
              "element" : "author",
              "listMode" : "first",
              "variable" : "author"
            }
          ],
          "target" : [
            {
              "context" : "certificate",
              "contextType" : "variable",
              "element" : "issuer",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "author"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "PatientToDDCC",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "patient",
          "mode" : "source"
        },
        {
          "name" : "ddcc",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set name",
          "source" : [
            {
              "context" : "patient",
              "element" : "name",
              "variable" : "name"
            }
          ],
          "dependent" : [
            {
              "name" : "NameToText",
              "variable" : [
                "name",
                "ddcc"
              ]
            }
          ]
        },
        {
          "name" : "set birthdate",
          "source" : [
            {
              "context" : "patient",
              "element" : "birthDate",
              "variable" : "birthDate"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "birthDate",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "birthDate"
                }
              ]
            }
          ]
        },
        {
          "name" : "set identifier",
          "source" : [
            {
              "context" : "patient",
              "element" : "identifier",
              "listMode" : "first",
              "variable" : "identifier"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "identifier",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "identifier"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "NameToText",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "name",
          "type" : "HumanName",
          "mode" : "source"
        },
        {
          "name" : "ddcc",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "set first name",
          "source" : [
            {
              "context" : "name",
              "element" : "given",
              "listMode" : "first",
              "variable" : "given"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "given.replaceMatches('$', ' ')"
                }
              ]
            }
          ]
        },
        {
          "name" : "set other names",
          "source" : [
            {
              "context" : "name",
              "element" : "given",
              "listMode" : "not_first",
              "variable" : "other"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "tName"
            },
            {
              "contextType" : "variable",
              "variable" : "spaced",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "other.replaceMatches('$', ' ')"
                }
              ]
            },
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "tName"
                },
                {
                  "valueId" : "spaced"
                }
              ]
            }
          ]
        },
        {
          "name" : "add family name",
          "source" : [
            {
              "context" : "name",
              "element" : "family",
              "variable" : "family"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "variable" : "tName"
            },
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "append",
              "parameter" : [
                {
                  "valueId" : "tName"
                },
                {
                  "valueId" : "family"
                }
              ]
            }
          ]
        },
        {
          "name" : "set full name",
          "source" : [
            {
              "context" : "name",
              "element" : "text",
              "variable" : "text"
            }
          ],
          "target" : [
            {
              "context" : "ddcc",
              "contextType" : "variable",
              "element" : "name",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "text"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

XIG built as of ??metadata-date??. Found ??metadata-resources?? resources in ??metadata-packages?? packages.